# 获取推荐文章的时间范围
import time
import datetime

def recommend_time():
    start_time = datetime.datetime.now() + datetime.timedelta(days = -1)
    end_time = datetime.datetime.now() + datetime.timedelta(days = -3)
    return time.mktime(time.strptime(str(start_time).split('.')[0], "%Y-%m-%d %H:%M:%S")), time.mktime(time.strptime(str(end_time).split('.')[0], "%Y-%m-%d %H:%M:%S"))

# 判断当前时间戳是否在当天
def now_time(timeStamp):
    timeArray = time.localtime(timeStamp)
    therStyleTime = time.strftime("%Y-%m-%d %H:%M:%S", timeArray)
    date_list  = therStyleTime.split(" ")[0].split("-")
    t_year = int(date_list[0])
    t_month = int(date_list[1])
    t_day = int(date_list[2])

    c_year = datetime.datetime.now().year
    c_month = datetime.datetime.now().month
    c_day = datetime.datetime.now().day

    final = False
    if c_year == t_year and c_month == t_month and c_day == t_day:
        final = True

    return final